package io.renren.modules.merchant.controller;

import io.renren.common.utils.R;
import io.renren.modules.dishes.entity.MerchantEntity;
import io.renren.modules.merchant.service.MessageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import static io.renren.common.utils.ShiroUtils.getUserId;

@RestController
@Slf4j
@RequestMapping("/merchantMessage")
public class MessageController {

    @Autowired
    private MessageService messageService;

    @GetMapping
    public R getMerchantMessage() {
        log.info("获取店铺信息");
        MerchantEntity merchant = messageService.getMerchantMessage();
        return R.ok().put("merchant", merchant);
    }

    @PutMapping("/updateStatus/{merchantStatus}")
    public R updateMerchantStatus(@PathVariable Integer merchantStatus){
        log.info("修改店铺状态{}",merchantStatus);
        messageService.updateMerchantStatus(merchantStatus);
        return R.ok();
    }
}
